﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Computer_Manager.DAL;
using Computer_Manager.DTO;

namespace Computer_Manager.BUS
{
    class BUS_product
    {
        DAL_product dal = new DAL_product();

        public void product_insert(DTO_product obj)
        {
            try
            {
                dal.product_insert(obj);
            }
            catch (Exception)
            {

                throw;
            }

        }

        public void product_Update(DTO_product obj)
        {
            try
            {
                dal.product_Update(obj);
            }
            catch (Exception){}
        }

        public void product_Delete(DTO_product obj)
        {
            try
            {
                dal.product_Delete(obj);
            }
            catch (Exception)
            {

                throw;
            }
        }

        public DataTable GetByID(DTO_product obj)
        {
            DataTable dt = new DataTable();
            try
            {
                dt = dal.GetByID(obj);
            }
            catch (Exception)
            {

                throw;
            }
            return dt;
        }

        public DataTable GetByCat(DTO_product obj)
        {
            DataTable dt = new DataTable();
            try
            {
                dt = dal.GetByCat(obj);
            }
            catch (Exception)
            {

                throw;
            }
            return dt;
        }

        //public DataTable GetByParentCat(DTO_product obj)
        //{
        //    DataTable dt = new DataTable();
        //    try
        //    {
        //        dt = dal.GetByParentCat(obj);
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }
        //    return dt;
        //}

        public DataTable GetAll()
        {
            DataTable dt = new DataTable();
            try
            {
                dt = dal.GetAll();

            }
            catch (Exception)
            {

                throw;
            }
            return dt;
        }
    }
}
